# A template descriptor for a quick start
#
# $Id: template.rb 4 2007-09-27 09:38:28Z dinko.srkoc $

TEMPLATE = <<TEMPLATE_END
# Ruby DSL for generating descriptors for Java persistence frameworks.
# Run 'pdgen' with this file to generate Java persistence descriptor,
# don't forget to fill in the 'HERE' places.
#
# Value for :descriptor can be one of:
# * :jpa
# * :hibernate_xml
# * :hibernate_properties
#
# :name is used to identify a persistence unit referred to by some annotations
# and, in the programmatic API, for creating an entity manager/session factory.
make :descriptor => :jpa, :name => 'PU name HERE' do
  
  # For JPA, persistence implementation can be one of:
  # * :hibernate_specific (default)
  # * :openjpa_specific
  # * :toplink_specific
  #persistence_implementation_is :hibernate_specific
  
  # If JNDI is used to fetch a data source, it can be done like this:
  # (by default, uses JTA)
  #data_source_is 'java:/NameDS', :jta => true

  # If JNDI is not used, then database connection needs to be configured directly.
  # DBMS can be one of:
  # * :postgresql
  # * :mysql
  # * :oracle  
  # * :sqlserver
  # * :informix
  # * :hsqldb
  dbms_is :postgresql do
    username_is 'dbuser HERE' # fill in the DB username
    password_is 'passwd HERE' # fill in the user's password
    database_is 'dbname HERE' # database name
    #host_is     'ahost'       # host name or IP address, default is localhost
    #port_is     5432          # if not given, uses default port for a DBMS (PostgreSQL=5432)
    #server_is   'server_name' # sometimes a DBMS server name is needed (Informix)
  end
  
  # possible options:
  #  * :show_sql ... logs SQL statements
  #  * one of :(create | drop | create_drop | update | validate)_database ... depends on a chosen implementor
  options :show_sql, :create_database
  
  # (hibernate | openjpa | toplink)_specific blocks add properties for a chosen
  # persistence implementation (see 'persistence_implementation_is' above)
  #openjpa_specific do
  #  add_property 'name', 'value' # ... for JPA, adds <property name='name' value='value'/>
  #end
end
TEMPLATE_END
